package com.flyxiaozhu.erp.core.entities;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: @Faith
 * Date: 2018/7/24
 * Time: 下午2:16
 */

@Entity
@Data
@DynamicInsert
@DynamicUpdate
@Table(indexes = {
        @Index(columnList = "username")
})
public class AdminUser extends BaseEntity {


    @Column(name = "`username`", columnDefinition = "varchar(64) not null default '' comment '用户名'")
    private String username;

    @JsonIgnore
    @Column(name = "`password`", columnDefinition = "varchar(32) not null default '' comment '密码'")
    private String password;

    @Column(name = "`realname`", columnDefinition = "varchar(32) not null default '' comment '真实姓名'")
    private String realname;

    @Column(columnDefinition = "tinyint(11) not null default 0 comment '状态'")
    private int status;

    @Transient
    private String tmpPwd = "******";

    @Transient
    private List<Long> roleId;

}
